<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSysPermissionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sys_permissions', function (Blueprint $table) {
            $table->increments('perm_id');
            $table->integer('parent_id')->default(0)->comment('父级角色ID');
            $table->string('name', 50)->default('')->comment('权限定义名');
            $table->string('display_name', 50)->default('')->comment('权限显示名');
            $table->text('description')->comment('权限描述');
            $table->smallInteger('order_num')->default(0)->comment('排序数字，值越小越靠前');
            $table->tinyInteger('is_public')->default(0)->comment('是否为公共权限,1:公共权限,0:授权权限');
            $table->tinyInteger('is_opentree')->default(1)->commit('是否展开树，1:展开，2:关闭');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sys_permissions');
    }
}
